package com.hmall.cart.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping;

@Configuration
public class RemoteConfig {
    private final BeanNameUrlHandlerMapping beanNameHandlerMapping;

    public RemoteConfig(BeanNameUrlHandlerMapping beanNameHandlerMapping) {
        this.beanNameHandlerMapping = beanNameHandlerMapping;
    }

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
        return  new RestTemplate();
    }
}
